home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 24 / CU Amiga Magazine's Super CD-ROM 24 (1998)(EMAP Images)(GB)(Track 1 of 2)[!][issue 1998-07].iso / CUCD / Programming / MCC_NList / Developer / Amiga-E / fakestack.lha / fakestack.e next >
Encoding:
Text File  |  1997-03-22  |  594 b   |  35 lines

  1. OPT MODULE
  2.  
  3. MODULE 'exec/tasks'
  4.  
  5. EXPORT PROC fakestack(param=0)
  6. DEF st:stackswapstruct,stackptr
  7. DEF task:tc,x,stack:PTR TO stackswapstruct
  8.   
  9.   stack:=param
  10.   IF param=0
  11.     stack:=st
  12.     MOVE.L A7,stackptr
  13.     stack.lower:=stackptr-FreeStack()
  14.     stack.upper:=stackptr+136
  15.   ENDIF
  16.   IF KickVersion(37)
  17.     MOVE.L A7,stackptr
  18.     stack.pointer:=stackptr
  19.     StackSwap(stack)
  20.   ELSE
  21.     Forbid()
  22.     task:=FindTask(0)
  23.  
  24.     x:=task.splower
  25.     task.splower:=stack.lower
  26.     stack.lower:=x
  27.  
  28.     x:=task.spupper
  29.     task.spupper:=stack.upper
  30.     stack.upper:=x
  31.  
  32.     Permit()
  33.   ENDIF
  34. ENDPROC stack
  35.